load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "collection_crud",
    srcs = [
        "capped_collection_maintenance.cpp",
        "collection_write_path.cpp",
    ],
    deps = [
        "//src/mongo/db:record_id_helpers",
        "//src/mongo/db:shard_role_api",
        "//src/mongo/db:write_stage_common",
        "//src/mongo/db/op_observer:op_observer_util",
        "//src/mongo/db/query/query_stats",
        "//src/mongo/db/repl:local_oplog_info",
        "//src/mongo/db/repl:repl_coordinator_interface",
        "//src/mongo/db/shard_role/shard_catalog:document_validation",
        "//src/mongo/db/storage:index_entry_comparison",
        "//src/mongo/db/storage:record_store_base",
        "//src/mongo/db/storage:storage_options",
    ],
)

mongo_cc_library(
    name = "container_write",
    srcs = [
        "container_write.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db/op_observer",
        "//src/mongo/db/shard_role:shard_role_api_stor_ex",
        "//src/mongo/db/storage:container",
    ],
)

mongo_cc_unit_test(
    name = "db_capped_test",
    srcs = [
        "capped_collection_test.cpp",
        "capped_utils_test.cpp",
    ],
    tags = [
        "mongo_unittest_first_group",
        "server-collection-write-path",
    ],
    deps = [
        "//src/mongo/db:service_context_d_test_fixture",
        "//src/mongo/db/repl:oplog",
        "//src/mongo/db/repl:replmocks",
        "//src/mongo/db/repl:storage_interface_impl",
        "//src/mongo/db/shard_role/shard_catalog:catalog_control",
    ],
)
